<?php

class BoxHelper extends Helper {

	var $helpers = array('Html');


	function iniciaBloco($titulo = "Titulo",$tamanho = 345,$body_style = null, $title_style = null)
	{
		if($tamanho == null)
		  	$tamanho = 345;

		if($title_style != null)
			$title_style = $title_style.'; ';

		if($body_style != null)
			$body_style = $body_style.'; ';

	echo '

		<div class="box" style="width:'.$tamanho.'px;">
			<div>
				<div class="box_title_left">
					<div class="box_title_right" style="'.$title_style.'width:'.$tamanho.'px">
						<span class="box_title"> '.$titulo.' </span>
					</div>
				</div>
			</div>
			<div class="box_body" style="'.$body_style.'width:'.($tamanho-9).'px" >

			<div style="width:'.$tamanho.'px;">';
	}

	function iniciaBlocoPost($titulo = "Titulo",$tamanho = 345,$body_style = null, $title_style = null)
	{
		if($tamanho == null)
		  	$tamanho = 345;

		if($title_style != null)
			$title_style = $title_style.'; ';

		if($body_style != null)
			$body_style = $body_style.'; ';

	echo '

		<div class="box" style="width:'.$tamanho.'px;">
			<div>
				<div class="box_title_left">
					<div class="box_title_right" style="'.$title_style.'width:'.$tamanho.'px">
						<span class="box_title"> '.$titulo.' </span>
					</div>
				</div>
			</div>
			<div class="box_body" style="'.$body_style.'width:'.($tamanho+3).'px" >

			<div style="width:'.($tamanho+3).'px;">';
	}

	function iniciaBlocoFotos($titulo = "Titulo",$tamanho = 600,$body_style = null, $title_style = null)
	{
		if($tamanho == null)
		  	$tamanho = 600;

		if($title_style != null)
			$title_style = $title_style.'; ';

		if($body_style != null)
			$body_style = $body_style.'; ';

	echo '

		<div class="boxFotos" style="width:'.$tamanho.'px;">
			<div>
				<div class="box_title_left">
					<div class="box_title_right" style="'.$title_style.'width:'.$tamanho.'px">
						<span class="box_title"> '.$titulo.' </span>
					</div>
				</div>
			</div>
			<div class="box_body" style="'.$body_style.'width:'.($tamanho-9).'px" >

			<div style="width:'.$tamanho.'px;">';
	}


	function finalizaBloco(){

		echo '</div>
			</div>
		</div>';
	}

	

	function criaPost($post = null, $zebrado = true)
	{
		$html = new HtmlHelper();
		$time = date('d/m/Y - G:i',strtotime($post['Post']['created']));
		$this->iniciaBlocoPost($time,625,'padding:0px;float:none;display:block;','float:none;display:block;');

		 	?>
				<table style="width:625px; margin-top:35px; border-style:none;">

					<tr>
						<td style="width:20%;border-style:none; text-align:center;">
							<?php
							if (!empty($post['User']['photo'])) {
								echo $html->image('../../../users/photo/'.$post['User']['id'],array('class'=>'forumPhoto'));
							}
							?>
							<br>
							<span>
							<?php
							echo $html->link($post['User']['name'],"/users/view/".$post['User']['id']);?>
						</span>
						</td>
						<td style="width:80%;border-style:none;">
							<span id="TEXTO-Titulo" class="content" style="float:none;display:block; width: 100%; text-align:top">
							<b> <? echo $post['Post']['title']; ?> </b>
						</span>

						<span id="TEXTO-Conteudo" class="content" style="float:none;display:block; margin-top:10px; width: 100%; text-align:top">
							<? echo $post['Post']['text'];?>
						</span>
						</td>
					</tr>
				</table>
				

			<?php
			$this->finalizaBloco();
	}



}


?>
